home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: presby.edu!jtbell
- From: jtbell@presby.edu (Jon Bell)
- Subject: Re: C++ beginner quesion on data member access.
- Message-ID: <DpppH8.Muw@presby.edu>
- Date: Thu, 11 Apr 1996 19:15:07 GMT
- References: <4kgb76$r3s@HOPPER.ACM.ORG> <Dpnpqz.2Io@presby.edu> <4kjhu2$338@HOPPER.ACM.ORG>
- Organization: Presbyterian College, Clinton, South Carolina USA
-
- Ken Varn <varnk@e62.diebold.com> wrote:
- >I am not questioning the validity of performing calculations using get or set
- >member functions, I am mainly interested in if you should or should not
- >always use get and set member functions when accessing data members if no
- >calculations are needed.
-
- If you are *absolutely*positively*certain* that you will *never*ever*
- want to reorganize the member data of a certain class, after you have
- already written code that uses that class; or if you are sure that you
- (or anybody else who uses that class) will not mind re-writing any code
- that uses the member data of that class, if you *do* reorganize the
- member data... then I see no harm in making the member data public and
- accessing it directly without get/set member functions.
-
- If you think there is any possiblilty that you might want to reorganize
- the member data later, then it is up to you to evaluate the tradeoff
- between the time you save now by not writing get/set member functions,
- and the time you (or somebody else) *might* save later by not having to
- rewrite code that uses the member data directly. It's your choice! :-)
-
- --
- Jon Bell <jtbell@presby.edu> Presbyterian College
- Dept. of Physics and Computer Science Clinton, South Carolina USA
-